<?php
include('top.php');
require_once('pasmy/dbwaarden.php');
/*echo "dbhost = $dbhost<br>";*/

$mysql_id = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($db, $mysql_id);
if(isset($_POST["zoek"])) {
$ville = mysql_real_escape_string($_POST["ville"]);
$zip = $_POST["zip"];
if(!empty($zip)){
	$sql = "select * from postnr where `C` = '$zip'";
	}
else {
	$ville = str_replace(" ","-",$ville);
	//echo "ville = $ville";exit;
	$sql = "select * from postnr where `D` like '%$ville%'";
	}
//echo "sql = $sql";
$spat ="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<h2><div style='text-align: center'>$pcode[$taal]</div></h2><br /><br />";
$res = mysql_query($sql, $mysql_id);
while ($row = mysql_fetch_row($res)) {

echo "$spat<strong>$postcode[$taal] : $row[2]</strong><br>";	
echo "$spat<strong>$plaats[$taal] : $row[3]</strong><br>";
echo "$spat<strong>$mainplaats[$taal] : $row[1]</strong><br><br />";
}
//echo "gedaan";	
}
else {
?>


<h2><div style="text-align: center"><?php echo $pcode[$taal];?></div></h2>	
<form action="postnr.php" method="post">
<table align="center">
<tr><td><strong><?php echo $postcode[$taal];?></strong></td><td><input type="text" name="zip" size="10" maxlength="10" /></td></tr>
<tr><td><div style="text-align: center"><strong><?php echo $of[$taal];?></strong></div></td><td>&nbsp;</td></tr>
<tr><td><strong><?php echo $plaats[$taal];?></strong></td><td><input type="text" name="ville" size="30" maxlength="80" /</td></tr>
<tr><td colspan="2"><br /><input type="submit" name="zoek" value="<?php echo $zoeken[$taal];?>" /></td></tr>
</table>

</form>
<?php
}
include('footer.php');
?>